Skip to main content
Version: Latest (Core: 0.57.x, Azure: 0.43.x)

How to generate DPG

This page documents how to build a Data-Plane SDK from your TYPESPEC specification. For an overview of the whole process from initial API design to shipping SDKs, please visit https://aka.ms/azsdk/dpcodegen.

The best documentation on how to generate can found using those links:

At a glance, add your emitter name to your package.json, along with the right options in the tspconfig.yaml.

NOTE: It may be complicated to generate all languages from the same folder at the moment as DPG and typespec-azure-core are still in preview. It's recommended that you keep each package.json with a unique language emitter, as they are likely to conflict, until all emitters and typespec-azure-core reach their first stable release.

Update your package.json to contain dependencies on DPG language emitter(s). Don't forget to do npm install after an update of the file:

{
"name": "clients",
"dependencies": {
"@typespec/compiler": "latest",
"@typespec/rest": "latest",
"@typespec/http": "latest",
"@azure-tools/typespec-azure-core": "latest",
"@azure-tools/typespec-python": "latest"
},
"private": true
}

To get your code emitting without having to pass several options on the command line, the easiest way is to update your tspconfig.yaml file:

emit:
# Emitter for Swagger files with Autorest Extensions
- "@azure-tools/typespec-autorest"
# add "@azure-tools/typespec-python" to your package.json to generate Python code
- "@azure-tools/typespec-python"
# add "@azure-tools/typespec-java" to your package.json to generate Java code
- "@azure-tools/typespec-java"
# add "@azure-tools/typespec-csharp" to your package.json to generate C# code
- "@azure-tools/typespec-csharp"
# add "@azure-tools/typespec-ts" to your package.json to generate Typescript code
- "@azure-tools/typespec-ts"
options:
"@azure-tools/typespec-python":
package-name: azure-service-template

Several language repositories support the tsp-client tool to facilitate generating client libraries. For more information on the tool, see Getting started with tsp-client.